﻿<%@ Page Title="" EnableEventValidation="false" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="false" 
CodeFile="rptTargetPenerimaanlist.aspx.cs" Inherits="SIPO.Web.lists.Report.rptPenerimaanlist" %>

<asp:Content ID="ctnBody" ContentPlaceHolderID="body" runat="server">

    <script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
   
   
 
    <script type="text/javascript">
        $("#btnCancel").button({ icons: { primary: "ui-icon-close"} });
        $("#<%=Button1 %>").button({ icons: { primary: "ui-icon-print"} });
    </script>
   
	    <script type="text/javascript">
	        $(document).ready(function () {





	            $("#txtPeriode").val($('#<%=hfPeriodeKe.ClientID %>').val());


	            $("#btnCancel").click(function () {


	                $("#txtPeriode").val('');

	            });
	            if ($("#txtPeriode").val() == '') {
	                $("#trVersi").hide();
	            }
	            else {
	                $("#trVersi").show();
	                var handlerUrl = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getAcceptanceDetail.ashx?method=getdataversion") %>';
	                $citys = $("#<%=ddlVersi.ClientID %>");
	                $citys.get(0).options.length = 0;
	                $.ajax({
	                    type: 'POST',
	                    url: handlerUrl + '&Period=' + $("#txtPeriode").val().substring(6, 10),
	                    contentType: 'application/json',
	                    dataType: 'json',
	                    success: function (datas) {

	                        if (datas.length > 1) {
	                            //    $citys.get(0).options[0] = new Option("versi", "");
	                            $.each(datas, function (i, data) {
	                                $citys.append('<option value="' + data.Versi + '">' + data.Versi + '</option>');
	                            });

	                        } else if (datas.length == 1) {
	                            $citys.append('<option value="' + datas[0].Versi + '">' + datas[0].Versi + '</option>');
	                        }
	                        else {
	                            $("#trVersi").hide();
	                            $citys = $("#<%=ddlVersi.ClientID %>");
	                            $citys.get(0).options.length = 0;
	                            //    $citys.get(0).options[0] = new Option("versi", "");
	                            $citys.trigger('chosen:updated');
	                        }

	                        $citys.trigger('chosen:updated');
	                        $("#<%=ddlVersi.ClientID %>").val($('#<%=hfVersi.ClientID %>').val());
	                    },
	                    error: function () {
	                        alert('Error!');
	                    }
	                });
	            }

	            $("#txtPeriode").datepicker({ showWeek: true, showButtonPanel: true,
	                changeYear: true, dateFormat: 'dd/mm/yy', changeMonth: true,
	                onClose: function () {
	                    if ($("#txtPeriode").val() != '') {
	                        $("#trVersi").show();
	                        var handlerUrl = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getAcceptanceDetail.ashx?method=getdataversion") %>';
	                        $citys = $("#<%=ddlVersi.ClientID %>");
	                        $citys.get(0).options.length = 0;
	                        $.ajax({
	                            type: 'POST',
	                            url: handlerUrl + '&Period=' + $("#txtPeriode").val().substring(6, 10),
	                            contentType: 'application/json',
	                            dataType: 'json',
	                            success: function (datas) {

	                                if (datas.length > 1) {
	                                    //    $citys.get(0).options[0] = new Option("versi", "");
	                                    $.each(datas, function (i, data) {
	                                        $citys.append('<option value="' + data.Versi + '">' + data.Versi + '</option>');
	                                    });

	                                } else if (datas.length == 1) {
	                                    $citys.append('<option value="' + datas[0].Versi + '">' + datas[0].Versi + '</option>');
	                                }
	                                else {
	                                    $("#trVersi").hide();
	                                    $citys = $("#<%=ddlVersi.ClientID %>");
	                                    $citys.get(0).options.length = 0;
	                                    //    $citys.get(0).options[0] = new Option("versi", "");
	                                    $citys.trigger('chosen:updated');
	                                }

	                                $citys.trigger('chosen:updated');

	                            },
	                            error: function () {
	                                alert('Error!');
	                            }
	                        });
	                    }
	                }
	                //	                    else {
	                //	                        $("#trVersi").hide();
	                //	                        $citys = $("#<%=ddlVersi.ClientID %>");
	                //	                        $citys.get(0).options.length = 0;
	                //	                        //   $citys.get(0).options[0] = new Option("versi", "");
	                //	                        $citys.trigger('chosen:updated');
	                //	                    }


	                //                }
	                //                else
	                //                {
	                //                
	                //                }
	                // }
	            });

	            $('#<%=Button1.ClientID %>').click(function () {

	                $('#<%=hfPeriodeKe.ClientID %>').val($("#txtPeriode").val());
	                $('#<%=hfVersi.ClientID %>').val($('#<%=ddlVersi.ClientID %>').val());
	            });


	        });
           </script>
   
  
  
   

    <h2>Laporan Target Penerimaan</h2>

<table>
    
   
    
    <tr>
        <td style="width: 50">
            Pilih Periode
        </td>
        <td>:</td>
       
        <td><input type="text" id="txtPeriode" /></td>
    </tr>
    <tr id="trVersi">
        <td style="width: 50">
            Pilih Versi
        </td>
        <td>:</td>
       
        <td>
            <asp:DropDownList ID="ddlVersi" runat="server">
            </asp:DropDownList>
        </td>
    </tr>
    
    <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                <asp:Button ID="Button1" runat="server" Text="Cetak" onclick="Button1_Click" />
                       
                       
                    &nbsp;&nbsp;     
                       
                      
                      <input type="button" id="btnCancel" value="Batal" />
                </div>
            </td>
        </tr>
</table>
    <asp:HiddenField ID="hfPeriodeKe" runat="server" />
    <%--<asp:HiddenField ID="hfSubSubSektorID" runat="server" />
    <asp:HiddenField ID="hfTransTypeID" runat="server" />
    <asp:HiddenField ID="hfPeriodeAwal" runat="server" />
    <asp:HiddenField ID="hfPeriodeAkhir" runat="server" />
    <asp:HiddenField ID="hfDetail" runat="server" /--%>&nbsp;<asp:HiddenField 
        ID="hfVersi" runat="server" />
    <br />
    <br />
<div>
        <asp:ScriptManager ID="scManager" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>
        <rsweb:ReportViewer ID="rsViewer" 
            runat="server" Height="100%" SizeToReportContent="true" Width="100%" 
            HyperlinkTarget="_blank" AsyncRendering="False" KeepSessionAlive="False">
        </rsweb:ReportViewer>
         
    
    </div>
    
 
</asp:Content>